package com.nativetalk.base;

/**
 * Created by lizhun on 16/1/13.
 */
public class Page {
    private int currentPage = 1;
    private int pageSize = 10;
    private Object obj;//cou_id
    private Integer dict_id;//排序类型，0：综合排序；1：授课时长；2：老师好评
    private Integer teacher_language_id;//351中教，350外教
    private Integer categoryId;//老师分类id
    private Integer mes_type;//消息类型 1系统消息  2评价消息
    private int offset;
    private int row_count;

    public Integer getMes_type() {
        return mes_type;
    }

    public void setMes_type(Integer mes_type) {
        this.mes_type = mes_type;
    }


    public Integer getCategoryId() {
        return categoryId;
    }

    public void setCategoryId(Integer categoryId) {
        this.categoryId = categoryId;
    }

    public int getOffset() {
        return currentPage > 0 ? ((currentPage - 1) * pageSize) : 0;
    }


    public int getRow_count() {
        return pageSize;
    }


    public Integer getTeacher_language_id() {
        return teacher_language_id;
    }

    public void setTeacher_language_id(Integer teacher_language_id) {
        this.teacher_language_id = teacher_language_id;
    }

    public Integer getDict_id() {
        return dict_id;
    }

    public void setDict_id(Integer dict_id) {
        this.dict_id = dict_id;
    }

    public Object getObj() {
        return obj;
    }

    public void setObj(Object obj) {
        this.obj = obj;
    }

    public void setCurrentPage(int currentPage) {
        this.currentPage = currentPage;
    }

    public void setPageSize(int pageSize) {
        this.pageSize = pageSize;
    }

    public int getCurrentPage() {
        return currentPage;
    }

    public int getPageSize() {
        return pageSize;
    }


    public int getTotalPage(Integer cou_totalRecord) {
        int cou_totalPage = 0;//总页数
        if (cou_totalRecord == null || cou_totalRecord.intValue() == 0) {
            return cou_totalPage;
        }

        int cou_pageSize = this.getPageSize();

        if (cou_totalRecord % cou_pageSize == 0) {
            cou_totalPage = cou_totalRecord / cou_pageSize;
        } else {
            cou_totalPage = (cou_totalRecord / cou_pageSize) + 1;
        }
        return cou_totalPage;
    }
}
